#coding:utf-8
"""
*   Coder    : Dzlua
*   Email    : 505544956@qq.com
*   Time     : 2017/08/30
"""
#--------------------#
from flask import Flask
from apis import APIMgr
from models import MoudleMgr
from utilities import helper

import config

#--------------------#
from flask_bootstrap import Bootstrap

#--------------------#
app = Flask(__name__, 
    static_url_path=config.StaticUrlPath,
    static_folder=config.StaticFolder,
    template_folder=config.TemplateFolder)

#--------------------#
apimgr = APIMgr(app, config.ApiRouteRoot)
apimgr.start()
modelmgr = MoudleMgr(app)

#--------------------#
bs = Bootstrap(app)

#--------------------#
@app.route('/', methods=['POST', 'GET'])
def index():
    return helper.render_template('index.html',page=1)
#----------#
@app.errorhandler(404)
def not_found(error):
    msg = helper.jsonify({'error': 'Not found'})
    return helper.make_response(msg, 404)

#--------------------#
if __name__ == '__main__':
    app.run(host=config.TgyHost, port=config.TgyPort, debug=config.Debug)

#--------------------#